package thinkingJava.chapter11;

import java.util.LinkedList;

import thinkingJava.chapter14.Pet;
import thinkingJava.chapter14.Pets;
import thinkingJava.chapter14.Rat;

public class LinkedListFeatures {
	public static void main(String[] args) {
		LinkedList<Pet> pets = new LinkedList<Pet>(Pets.arrayList(5));
		print(pets);
		print("pets.getFirst() : " + pets.getFirst());
		print("pets.Element() : " + pets.element());
		print("pets.peek() : " + pets.peek());
		print("pets.remove() : " + pets.remove());
		print("pets.removeFirst() : " + pets.removeFirst());
		print("pets.poll() : " + pets.poll());
		print(pets);
		pets.addFirst(new Rat());
		print("After addFirst() : " + pets);
		pets.offer(Pets.randomPet());
		print("After offer() : " + pets);
		pets.add(Pets.randomPet());
		print("After add() : " + pets);
		pets.addLast(Pets.randomPet());
		print("Ater addLast() : " + pets);
		print("pets.removeLast() : " + pets.removeLast());
		print(pets);
	}
	public static void print(Object o) {
		System.out.println(o);
	}
}
